<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>医疗机构查看</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>医疗机构目录查看</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">目录管理</a></li>
            <li class="active"><a href="#">医疗机构目录查看</a></li>
        </ol>
    </section>
    <section class="content">
      <form id="form" method="post" class="form-horizontal">
        <div class=" box box-success">
            <div class="box-body">
               <div class="input">
                    <div class="textalign1">医疗机构名称：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="shospName" placeholder="医疗机构名称"/>
                    </div>
                    <div class="textalign">医疗机构编码：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="hospCode" placeholder="医疗机构编码"/>
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.yiLiaoJiGouFenLei"/>：</div>
                    <div class="boxinput">
                        <select class="textinput"  id="shospCl" >
                            <option selected="selected" value="">请选择</option>
                             <c:forEach items="${clList}" var="cl">
                                <option  value="${cl.dicCode}">${cl.dicName}</option>
                            </c:forEach>
                        </select>
                    </div>
               </div>
               <div class="input" style="margin-top:-5px">
                    <div class="textalign1">医疗机构地区：</div>
                    <div class="boxinput">
                       <table style="width:100%;">
                           <tr>
                              <td style="width:33%">
                                <select class="textinput" id="sysAreaId" name="sysAreaId" disabled="disabled">
                                    <option value="${area.areaId}">${area.areaName}</option>
                                </select>
                              </td>
                              <td style="width:33%">   
                                <select class="textinput"  id="area1Id"></select>
                                </td>
                              <td style="width:33%">
                                <select class="textinput"  id="area2Id"></select>
                              </td>
                           </tr> 
                        </table>     
                    </div>
                    <div class="textalign" >
                        <button type="button" class="btn btn-success btn-sm" onclick="search()">查&nbsp;询</button>
                    </div> 
               </div>
            </div>
          </div>
        </form>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    function search(page) {
        var shospName = $("#shospName").val();
        var shospCl = $("#shospCl").val();
        var hospCode = $("#hospCode").val();
        var areaId = $("#area2Id").val();
        if (areaId == null || areaId == "") {
        	areaId = $("#area1Id").val();
        }
        if (areaId == null || areaId == "") {
            areaId = $("#sysAreaId").val();
        }
        $("#gridlist").jqGrid("clearGridData");
            $("#gridlist").jqGrid('setGridParam',{  
            mtype: "POST",
            datatype:'json',
            postData:{"hospName":shospName, "hospClassify":shospCl, "hospCode":hospCode,"areaId":areaId},
            page : (page || 1)
        }).trigger("reloadGrid"); //重新载入  
    }
    
        $(function () {
            
            $("#gridlist").jqGrid({
                url: "getHospListByYY.html",
                mtype: "POST",
                postData: { "projId" : "${bidProject.projId}"},
                datatype: "json",
                autowidth: true,
                height: 325,
                colNames: ['医疗机构ID', '医疗机构编码', '医疗机构名称', '医疗机构地区',
                           '<spring:message code="message.listForm.yiLiaoJiGouFenLei"/>', 
                           '<spring:message code="message.listForm.yiLiaoJiGouLeiXing"/>',
                           '医疗机构等级', '组织机构代码'],
                colModel: [
                    { name: 'hospId', width: 80 , align:"center" ,sortable: false, hidden:true},
                    { name: 'hospCode', width: 60 , align:"center",sortable: false},
                    { name: 'hospName', width: 60 , align:"left" ,sortable: false,
                        formatter:function(cellvalue, options, row){
                            return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.hospId+"','医疗机构详情','stdHospInfo/hospInfoDetail.html?hospId="+row.hospId+"','800px','400px')\">"+cellvalue+"</a>";
                       }
                    },
                    { name: 'areaName', width: 60 , align:"center" ,sortable: false},
                    { name: 'classifyName', width: 50 , align:"center" ,sortable: false},
                    { name: 'hospTypeName', width: 40 , align:"center" ,sortable: false},
                    { name: 'hospLevelName', width: 40 , align:"center" ,sortable: false},
                    { name: 'orgCode', width: 50 , align:"center",sortable: false }
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "医疗机构列表 ",
                jsonReader: {
                    repeatitems: false,
                    id: "drugId"
                }
            });
            
            $("#area1Id").HNSelect({
                url: "${ctx}/selectController/getArea.html", 
                data: { ID: '${sysAreaId}' }, 
                defaultText: "<option value=''>请选择</option>",
                defaultselect: "",
                func: function () {
                    $("#area2Id").HNSelect({
                        parent_selector: "#area1Id", 
                        url: "${ctx}/selectController/getArea.html", 
                        dataid: "ID", 
                        defaultText: "<option value=''>请选择</option>",
                        defaultselect: ""
                    });
                }
            });         
            
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            
        });
      
    </script>
</body>
</html>